//
//  XiaoKaiAttackTableViewCell.m
//  Project_A
//
//  Created by 凯 on 15/7/14.
//  Copyright (c) 2015年 zhoukaidong. All rights reserved.
//

#import "XiaoKaiAttackTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "BaseHeader.h"

@implementation XiaoKaiAttackTableViewCell
- (void)dealloc
{
    [_image release];
    [_label release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.image = [[[UIImageView alloc]init]autorelease];
        [self.contentView addSubview:self.image];
        
        self.label = [[[UILabel alloc]init]autorelease];
        [self.image addSubview:self.label];
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.image.frame = CGRectMake(5, 5, SCREEN_WIDTH - 10, SCREEN_HEIGHT / 4);
    self.label.frame = CGRectMake(10, self.image.frame.size.height - 40 ,SCREEN_WIDTH - 20, 40);
    self.label.numberOfLines = 1;
    
    self.label.textColor = [UIColor whiteColor];
    self.label.font = [UIFont systemFontOfSize:20];
    
    self.image.backgroundColor = [UIColor clearColor];
    self.label.backgroundColor = [UIColor clearColor];
    
}
-(void)setModel:(XiaoKaiAttackModel *)model
{
    if ( _Model != model) {
        [_Model release];
        _Model = [model retain];
    }
    self.label.text = model.title;
    [self.image setImageWithURL:[NSURL URLWithString:model.cover_image_url]];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
